<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<script type="text/javascript" src="../js/jquery-3.3.1.js"></script>
<body>
	分区<select id="areaNo">
			<option value="1">1</option>
			<option value="2">2</option>
			<option value="3">3</option>
		</select>
	<table id="parkingtab" border="1px" cellpadding="0px"  cellpadding="0px">
	</table>
	<p id="areap"></p>
</body>
<script type="text/javascript">
	$(function(){
		var areaNo = $("#areaNo").val();
		function showParking(pageNo,areaNo){
			$("#parkingtab").html("<tr><th>Id</th><th>名称</th><th>操作</th></tr>");
			$("#areap").html("");
			$.ajax({
				url:"findareapage",
				type:"get",
				contentType:'application/json',
				async:false,
				data:{'pageNo':pageNo,'pageSize':pageSize},
				dataType:'json',
				success:function(data){
					pageNum = data.pageNum;
					$.each(data.areaPage,function(){
						var tr = document.createElement("tr");
						tr.innerHTML="<td>"+this.securityAreaId+"</td>"+
									 "<td>"+this.securityAreaName+"</td>"+
									 "<td><a href='/pmsystem/security/updatearea?id="+this.securityAreaId+"'>修改</a>/"+
			     					 "<a href='/pmsystem/security/deletearea?id="+this.securityAreaId+"'>删除</a></td>"
						$("#area table").append(tr);
			     	
					});
					for(var i=1;i<=pageNum;i++){
						if(i==pageNo){
							var a = "<a href='#' class='"+i+"' style='font-size:20px'>"+i+"<a/>";
							$("#areap").append(a);
						}else{
							var a = "<a href='#' class='"+i+"'>"+i+"<a/>";
							$("#areap").append(a);
						}
					}
					for(var i=1;i<=pageNum;i++){
						var id = "#areap ."+i;
						$(id).click(function(){
							showArea($(this).attr("class"));
						});
					}
				}
			})
		}
		showArea(1);
	})
</script>
</html>